"use strict";
cc._RF.push(module, 'c776bRPVNBD5YCwC54bFSug', 'GlobalUserData');
// scripts/GlobalUserData.js

"use strict";

var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {
  value: !0
});

var i = t("HallConstant"),
    n = t("GameConstant"),
    a = t("CarConstant"),
    r = t("Util"),
    s = t("Global"),
    l = t("BaseStorage"),
    c = t("ChampionManager"),
    d = function () {
  function t() {}

  return t.init = function () {
    this.initAIDifficultyLevelData(), this.initLoginTimeData(), this.initGuideStepData(), this.initRefreshArenaData(), this.initGoldData(), this.initTrophyData(), this.initDiamondData(), this.initVitData(), this.initGameGradeData(), this.initGameLevelData(), this.initCarUidData(), this.initBoxData(), this.initTotalGame(), this.initWinning(), this.initOpenBoxNum(), this.initWinTotal(), this.initArenaWinTotal(), this.initFailTotal(), this.initDayWin(), this.initDaySell(), this.initArenaModeData(), this.initEquipBodyData(), this.initEquipWheelData(), this.initEquipWeaponData(), this.initEquipToolsData(), this.initOwnCarBodyData(), this.initOwnWheelData(), this.initOwnWeaponData(), this.initOwnToolsData(), this.initOwnItemRecordData(), this.initUpgradeState(), this.initUserVersion(), this.initGradeData(), this.initGradeRewardList(), r.Util.initBuff(), cc.log("数据初始化完成");
  }, t.initGradeData = function () {
    var t = cc.sys.localStorage.getItem("user_GradeData_data");
    t ? this.gradeData = JSON.parse(t) : (this.gradeData = {
      bronzeGrade: {
        grade: c.GradeLevel.bronzeGrade,
        isHaveGot: !0
      },
      silverGrade: {
        grade: c.GradeLevel.silverGrade,
        isHaveGot: !1
      },
      goldGrade: {
        grade: c.GradeLevel.goldGrade,
        isHaveGot: !1
      },
      platinumGrade: {
        grade: c.GradeLevel.platinumGrade,
        isHaveGot: !1
      },
      diamondGrade: {
        grade: c.GradeLevel.diamondGrade,
        isHaveGot: !1
      },
      kingGrade: {
        grade: c.GradeLevel.kingGrade,
        isHaveGot: !1
      },
      superGrade: {
        grade: c.GradeLevel.superGrade,
        isHaveGot: !1
      }
    }, cc.sys.localStorage.setItem("user_GradeData_data", JSON.stringify(this.gradeData)));
  }, t.saveGradeData = function () {
    cc.sys.localStorage.setItem("user_GradeData_data", JSON.stringify(this.gradeData));
  }, t.initGradeRewardList = function () {
    var t = cc.sys.localStorage.getItem("user_GradeRewardList_data");
    if (t) this.gradeRewardList = JSON.parse(t);else {
      var e = c["default"].Ins.gradeRewardList;
      cc.sys.localStorage.setItem("user_GradeRewardList_data", JSON.stringify(e)), t = cc.sys.localStorage.getItem("user_GradeRewardList_data"), this.gradeRewardList = JSON.parse(t);
    }
  }, t.saveGradeRewardList = function () {
    cc.sys.localStorage.setItem("user_GradeRewardList_data", JSON.stringify(this.gradeRewardList));
  }, t.initUserVersion = function () {
    cc.sys.localStorage.getItem("user_version_data") || cc.sys.localStorage.setItem("user_version_data", this.Version), console.log(cc.sys.localStorage.getItem("user_version_data"));
  }, t.getUserVersion = function () {
    return cc.sys.localStorage.getItem("user_version_data");
  }, t.initLoginTimeData = function () {
    var e = cc.sys.localStorage.getItem("user_logintime_data");

    if (e) {
      var o = JSON.parse(e);
      t.nLoginTime = Number(o.time), t.nFirstDate = Number(o.first);
    } else t.nLoginTime = 0, t.nFirstDate = 0;
  }, t.initAIDifficultyLevelData = function () {
    var e = cc.sys.localStorage.getItem("ai_difficulty_level_data");

    if (e) {
      var o = JSON.parse(e);
      t.aIDifficultyLevelData = {
        win: o.win,
        fail: o.fail,
        level: o.level
      };
    } else t.aIDifficultyLevelData = {
      win: 0,
      fail: 0,
      level: 0
    };
  }, t.initGuideStepData = function () {
    var e = cc.sys.localStorage.getItem("user_guidestep_data");
    t.nGuideStep = e ? Number(e) : 0;
  }, t.initRefreshArenaData = function () {
    var t = cc.sys.localStorage.getItem("user_Arena_data");
    t && (this.userArenaData = JSON.parse(t));
  }, t.saveRefreshArenaData = function () {
    var t = JSON.stringify(this.userArenaData);
    cc.sys.localStorage.setItem("user_Arena_data", t);
  }, t.saveLoginTimeData = function () {
    0 == this.nLoginTime && (this.nFirstDate = new Date().getTime()), this.nLoginTime++;
    var t = {
      time: this.nLoginTime,
      first: this.nFirstDate
    };
    cc.sys.localStorage.setItem("user_logintime_data", JSON.stringify(t));
  }, t.saveGuideStepData = function (t) {
    void 0 === t && (t = -1), -1 == t ? this.nGuideStep++ : this.nGuideStep = t, cc.sys.localStorage.setItem("user_guidestep_data", this.nGuideStep);
  }, t.initGoldData = function () {
    var e = cc.sys.localStorage.getItem("user_gold_data");
    t.nGlod = e ? Number(e) : 2e3;
  }, t.initTrophyData = function () {
    var e = cc.sys.localStorage.getItem("user_trophy_data");
    t.nTrophy = e ? Number(e) : 0;
  }, t.initDiamondData = function () {
    var e = cc.sys.localStorage.getItem("user_diamond_data");
    t.nDiamond = e ? Number(e) : 100;
  }, t.initVitData = function () {
    var e = cc.sys.localStorage.getItem("user_vit_data");

    if (e) {
      var o = JSON.parse(e);
      t.vitData.time = Number(o.time), t.vitData.num = Number(o.num);
    } else t.vitData.time = 0, t.vitData.num = i.Vit_Init_Num;
  }, t.saveAIDifficultyLevelData = function (e) {
    if (!(t.nGuideStep < i.Guide_Step.Assembly_In)) {
      var o,
          n = t.aIDifficultyLevelData.level;
      e ? (t.aIDifficultyLevelData.win++, (o = n % 4) < 3 && t.aIDifficultyLevelData.win % 2 == 0 && (t.aIDifficultyLevelData.level++, t.aIDifficultyLevelData.win = 0), 3 == o && t.aIDifficultyLevelData.win % 3 == 0 && (t.aIDifficultyLevelData.level++, t.aIDifficultyLevelData.win = 0, t.aIDifficultyLevelData.fail = 0), t.aIDifficultyLevelData.level > 20 && (t.aIDifficultyLevelData.level = 20)) : (t.aIDifficultyLevelData.fail++, (o = n % 4) < 3 && t.aIDifficultyLevelData.level--, 3 == o && t.aIDifficultyLevelData.fail % 2 == 0 && (t.aIDifficultyLevelData.level--, t.aIDifficultyLevelData.fail = 0, t.aIDifficultyLevelData.win = 0), t.aIDifficultyLevelData.level < 0 && (t.aIDifficultyLevelData.level = 0)), cc.log("ai_difficulty_level_data:" + JSON.stringify(t.aIDifficultyLevelData)), cc.sys.localStorage.setItem("ai_difficulty_level_data", JSON.stringify(t.aIDifficultyLevelData));
    }
  }, t.saveGoldData = function (t, e) {
    t ? this.nGlod += e : this.nGlod -= e, cc.sys.localStorage.setItem("user_gold_data", this.nGlod);
  }, t.saveTrophyData = function (t, e) {
    t ? this.nTrophy += e : this.nTrophy -= e, cc.sys.localStorage.setItem("user_trophy_data", this.nTrophy);
  }, t.getCurCarPower = function () {
    var e = {
      body: [],
      weapon: [],
      wheel: [],
      tools: []
    };
    e.body = [], e.weapon = [], e.wheel = [], e.tools = [];

    for (var o = 0; o < t.nEquipMax; o++) {
      var i = r.Util.getBodyData(t.curEquipBody[o]);
      if (!i) break;
      e.body.push(i);

      for (var n = [], a = 0; a < t.curEquipWheel.length; a++) {
        t.curEquipWheel[a] ? n.push(r.Util.getWheelData(t.curEquipWheel[o][a])) : n.push(null);
      }

      e.wheel.push(n);
      var s = [];

      for (a = 0; a < t.curEquipWeapon.length; a++) {
        t.curEquipWeapon[a] ? s.push(r.Util.getWeaponData(t.curEquipWeapon[o][a])) : s.push(null);
      }

      e.weapon.push(s);
      var l = [];

      for (a = 0; a < t.curEquipTools.length; a++) {
        t.curEquipTools[a] ? l.push(r.Util.getToolsData(t.curEquipTools[o][a])) : l.push(null);
      }

      e.tools.push(l);
    }

    return e;
  }, t.saveDiamondData = function (t, e) {
    t ? this.nDiamond += e : this.nDiamond -= e, cc.sys.localStorage.setItem("user_diamond_data", this.nDiamond);
  }, t.saveVitData = function (t, e) {
    t ? (this.vitData.num += e, this.vitData.num <= i.Vit_Init_Num && (this.vitData.time = new Date().getTime())) : (this.vitData.num >= i.Vit_Init_Num && this.vitData.num - e < i.Vit_Init_Num && (this.vitData.time = new Date().getTime()), this.vitData.num -= e);
    var o = {
      time: this.vitData.time,
      num: this.vitData.num
    };
    cc.sys.localStorage.setItem("user_vit_data", JSON.stringify(o));
  }, t.initGameGradeData = function () {
    var e = cc.sys.localStorage.getItem("user_gamegrade_data");
    t.nGameGrade = e ? Number(e) : 0;
  }, t.initGameLevelData = function () {
    var e = cc.sys.localStorage.getItem("user_gamelevel_data");
    t.nGameLevel = e ? Number(e) : 0;
  }, t.saveGameGradeData = function (t) {
    t ? this.nGameGrade++ : (this.nGameGrade--, this.nGameGrade < 0 && (this.nGameGrade = 0)), cc.sys.localStorage.setItem("user_gamegrade_data", this.nGameGrade);
  }, t.saveGameLevelData = function () {
    this.nGameLevel++, cc.sys.localStorage.setItem("user_gamelevel_data", this.nGameLevel);
  }, t.initCarUidData = function () {
    var e = cc.sys.localStorage.getItem("user_caruid_data");
    t.nCarItemsUid = e || 1e3;
  }, t.getCarItemsUid = function () {
    return this.nCarItemsUid++, cc.sys.localStorage.setItem("user_caruid_data", this.nCarItemsUid), this.nCarItemsUid;
  }, t.saveCarUidData = function () {
    this.nCarItemsUid++, cc.sys.localStorage.setItem("user_caruid_data", this.nCarItemsUid);
  }, t.saveSpareCoinData = function (t) {
    t < 0 && (t = 0), this.spareCoin = t;
  }, t.initArenaModeData = function () {
    var e = cc.sys.localStorage.getItem("user_arena_mode_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.arenaModeDataList.push(o[i]);
    } else t.arenaModeDataList = [];
  }, t.initEquipBodyData = function () {
    var e = cc.sys.localStorage.getItem("user_equipbody_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.curEquipBody.push(o[i]);
    } else t.curEquipBody = [0, 0, 0];
  }, t.initEquipWheelData = function () {
    var e = cc.sys.localStorage.getItem("user_equipwheel_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.curEquipWheel.push(o[i]);
    } else t.curEquipWheel = [[0, 0], [0, 0], [0, 0]];
  }, t.initEquipWeaponData = function () {
    var e = cc.sys.localStorage.getItem("user_equipweapon_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.curEquipWeapon.push(o[i]);
    } else t.curEquipWeapon = [[0, 0], [0, 0], [0, 0]];
  }, t.initEquipToolsData = function () {
    var e = cc.sys.localStorage.getItem("user_equiptools_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.curEquipTools.push(o[i]);
    } else t.curEquipTools = [[0, 0], [0, 0], [0, 0]];
  }, t.initOwnCarBodyData = function () {
    var e = cc.sys.localStorage.getItem("user_ownbody_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.arrOwnBody.push(o[i]);
    } else t.arrOwnBody = [];
  }, t.initOwnWheelData = function () {
    var e = cc.sys.localStorage.getItem("user_ownwheel_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.arrOwnWheel.push(o[i]);
    } else t.arrOwnWheel = [];
  }, t.initOwnWeaponData = function () {
    var e = cc.sys.localStorage.getItem("user_ownweapon_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.arrOwnWeapon.push(o[i]);
    } else t.arrOwnWeapon = [];
  }, t.initOwnToolsData = function () {
    var e = cc.sys.localStorage.getItem("user_owntools_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.arrOwnTools.push(o[i]);
    } else t.arrOwnTools = [];
  }, t.initOwnItemRecordData = function () {
    var e = cc.sys.localStorage.getItem("user_own_item_record_data");
    if (e) for (var o = JSON.parse(e), i = 0; i < o.length; i++) {
      t.arrItemRecord.push(o[i]);
    } else {
      for (var n = 0; n < t.arrOwnBody.length; n++) {
        this.saveOwnItemRecordData(t.arrOwnBody[n]);
      }

      for (n = 0; n < t.arrOwnWeapon.length; n++) {
        this.saveOwnItemRecordData(t.arrOwnWeapon[n]);
      }

      for (n = 0; n < t.arrOwnWheel.length; n++) {
        this.saveOwnItemRecordData(t.arrOwnWheel[n]);
      }

      for (n = 0; n < t.arrOwnTools.length; n++) {
        this.saveOwnItemRecordData(t.arrOwnTools[n]);
      }
    }
  }, t.initUpgradeState = function () {
    var t = cc.sys.localStorage.getItem("user_own_UpgradeState");
    this.upgradeState = t ? Number(t) : 0;
  }, t.saveUpgradeState = function () {
    this.upgradeState = 1, cc.sys.localStorage.setItem("user_own_UpgradeState", this.upgradeState);
  }, t.saveOwnItemRecordData = function (e) {
    var o = {
      type: e.type,
      id: e.id,
      quality: e.quality,
      star: e.star
    };

    if (!r.Util.comparison(o)) {
      t.arrItemRecord.push(e);
      var i = JSON.stringify(this.arrItemRecord);
      cc.sys.localStorage.setItem("user_own_item_record_data", i);
    }
  }, t.getDaliyTaskRedPointState = function (t) {
    var e = !1;

    switch (t) {
      case s.RedPointKey[s.RedPointKey.DailyTaskLotter]:
        e = !l.BaseStorage.getInt(s.RedPointKey[s.RedPointKey.DailyTaskLotter], 0) && l.BaseStorage.getInt(s.BaseStorageKey.UpgradeNumber, 0) >= 3;
        break;

      case s.RedPointKey[s.RedPointKey.DailyTaskVictory]:
        e = !l.BaseStorage.getInt(s.RedPointKey[s.RedPointKey.DailyTaskVictory], 0) && this.getDayWin() >= 10;
        break;

      case s.RedPointKey[s.RedPointKey.DailyTaskComponent]:
        e = !l.BaseStorage.getInt(s.RedPointKey[s.RedPointKey.DailyTaskComponent], 0) && l.BaseStorage.getInt(s.BaseStorageKey.GetBoxNumber, 0) >= 3;
        break;

      case s.RedPointKey[s.RedPointKey.DailyTaskBoxBonus]:
        e = !l.BaseStorage.getInt(s.RedPointKey[s.RedPointKey.DailyTaskBoxBonus], 0) && l.BaseStorage.getInt(s.BaseStorageKey.DailyTask + "bonus", 0) >= 3;
        break;

      default:
        e = !1;
    }

    return e;
  }, t.getExploreTaskRedPointState = function () {
    for (var t = !1, e = 0; e < 5; e++) {
      var o = l.BaseStorage.getString(s.BaseStorageKey.ExploreTaskState + e);

      if ("" == o || o == s.Status.start || o == s.Status.receive || r.Util.getTimeDifference(s.BaseStorageKey.TaskBonus + e) <= 0 && r.Util.getTimeDifference(s.BaseStorageKey.CoolDown + e) <= 0) {
        t = !0;
        break;
      }

      t = !1;
    }

    return t;
  }, t.getSignInRedPointState = function () {
    return l.BaseStorage.getInt(s.BaseStorageKey.clock, 0) < 2;
  }, t.getLotteryRedPointState = function () {
    return l.BaseStorage.getInt(s.BaseStorageKey.LotteryCount, 0) < 10;
  }, t.getDailyRedPointState = function () {
    var t = cc.sys.localStorage.getItem("user_DailyRedPointState");
    return !t || 2 == Number(t);
  }, t.saveDailyRedPointState = function (t) {
    cc.sys.localStorage.setItem("user_DailyRedPointState", t);
  }, t.getDepotRedPointState = function (e) {
    var o = 0,
        i = 0,
        n = "0";

    switch (e) {
      case s.RedPointKey[s.RedPointKey.DepotAM]:
        o = t.nDepotTime.am.star, i = t.nDepotTime.am.end, n = l.BaseStorage.getString(s.BaseStorageKey.Receive + "am");
        break;

      case s.RedPointKey[s.RedPointKey.DepotPM]:
        o = t.nDepotTime.pm.star, i = t.nDepotTime.pm.end, n = l.BaseStorage.getString(s.BaseStorageKey.Receive + "pm");
        break;

      case s.RedPointKey[s.RedPointKey.DepotEV]:
        o = t.nDepotTime.ev.star, i = t.nDepotTime.ev.end, n = l.BaseStorage.getString(s.BaseStorageKey.Receive + "ev");
    }

    return !(new Date().getHours() < o || new Date().getHours() > i || "1" == n);
  }, t.saveArenaModeData = function (t, e, o, i) {
    void 0 === o && (o = !1), void 0 === i && (i = 0), o ? (this.arenaModeDataList.splice(i, 1), this.arenaModeDataList.splice(i, 0, e)) : t ? this.arenaModeDataList.push(e) : this.arenaModeDataList.splice(this.arenaModeDataList.indexOf(e), 1);
    var n = JSON.stringify(this.arenaModeDataList);
    cc.sys.localStorage.setItem("user_arena_mode_data", n);
  }, t.saveEquipBodyData = function (t, e) {
    this.curEquipBody[t] = e;
    var o = JSON.stringify(this.curEquipBody);
    cc.sys.localStorage.setItem("user_equipbody_data", o);
  }, t.saveEquipWheelData = function (t, e, o) {
    this.curEquipWheel[t][e] = o;
    var i = JSON.stringify(this.curEquipWheel);
    cc.sys.localStorage.setItem("user_equipwheel_data", i);
  }, t.saveEquipWeaponData = function (t, e, o) {
    this.curEquipWeapon[t][e] = o;
    var i = JSON.stringify(this.curEquipWeapon);
    cc.sys.localStorage.setItem("user_equipweapon_data", i);
  }, t.saveEquipToolsData = function (t, e, o) {
    this.curEquipTools[t][e] = o;
    var i = JSON.stringify(this.curEquipTools);
    cc.sys.localStorage.setItem("user_equiptools_data", i);
  }, t.saveOwnCarBodyData = function (t, e, o) {
    if (t) {
      if (o) for (var i = 0; i < e.length; i++) {
        this.arrOwnBody.push(e[i]), this.saveOwnItemRecordData(e[i]);
      } else this.arrOwnBody.push(e), this.saveOwnItemRecordData(e);
    } else {
      var n = 0;

      if (o) {
        for (i = 0; i < e.length; i++) {
          for (var a = 0; a < this.arrOwnBody.length; a++) {
            if (this.arrOwnBody[a].uid == e[i].uid) {
              n++, this.arrOwnBody.splice(a, 1);
              break;
            }
          }
        }
      } else for (a = 0; a < this.arrOwnBody.length; a++) {
        if (this.arrOwnBody[a].uid == e.uid) {
          n++, this.arrOwnBody.splice(a, 1);
          break;
        }
      }

      this.saveDaySell(n);
    }

    var r = JSON.stringify(this.arrOwnBody);
    cc.sys.localStorage.setItem("user_ownbody_data", r);
  }, t.saveTempCarData = function (t) {
    var e;

    switch (t) {
      case a.Basics_Items_Type.body:
        e = JSON.stringify(this.arrOwnBody), cc.sys.localStorage.setItem("user_ownbody_data", e);
        break;

      case a.Basics_Items_Type.weapon:
        e = JSON.stringify(this.arrOwnWeapon), cc.sys.localStorage.setItem("user_ownweapon_data", e);
        break;

      case a.Basics_Items_Type.wheel:
        e = JSON.stringify(this.arrOwnWheel), cc.sys.localStorage.setItem("user_ownwheel_data", e);
        break;

      case a.Basics_Items_Type.tools:
        e = JSON.stringify(this.arrOwnTools), cc.sys.localStorage.setItem("user_owntools_data", e);
    }
  }, t.upGradeBodyData = function (t) {
    for (var e = 0; e < this.arrOwnBody.length; e++) {
      if (this.arrOwnBody[e].uid == t.uid) {
        this.arrOwnBody[e].level = t.level;
        break;
      }
    }

    var o = JSON.stringify(this.arrOwnBody);
    cc.sys.localStorage.setItem("user_ownbody_data", o);
  }, t.saveOwnWheelData = function (t, e, o) {
    if (t) {
      if (o) for (var i = 0; i < e.length; i++) {
        this.arrOwnWheel.push(e[i]), this.saveOwnItemRecordData(e[i]);
      } else this.arrOwnWheel.push(e), this.saveOwnItemRecordData(e);
    } else {
      var n = 0;

      if (o) {
        for (i = 0; i < e.length; i++) {
          for (var a = 0; a < this.arrOwnWheel.length; a++) {
            if (this.arrOwnWheel[a].uid == e[i].uid) {
              n++, this.arrOwnWheel.splice(a, 1);
              break;
            }
          }
        }
      } else for (a = 0; a < this.arrOwnWheel.length; a++) {
        if (this.arrOwnWheel[a].uid == e.uid) {
          n++, this.arrOwnWheel.splice(a, 1);
          break;
        }
      }

      this.saveDaySell(n);
    }

    var r = JSON.stringify(this.arrOwnWheel);
    cc.sys.localStorage.setItem("user_ownwheel_data", r);
  }, t.upGradeWheelData = function (t) {
    for (var e = 0; e < this.arrOwnWheel.length; e++) {
      if (this.arrOwnWheel[e].uid == t.uid) {
        this.arrOwnWheel[e].level = t.level;
        break;
      }
    }

    var o = JSON.stringify(this.arrOwnWheel);
    cc.sys.localStorage.setItem("user_ownwheel_data", o);
  }, t.saveOwnWeaponData = function (t, e, o) {
    if (t) {
      if (o) for (var i = 0; i < e.length; i++) {
        this.arrOwnWeapon.push(e[i]), this.saveOwnItemRecordData(e[i]);
      } else this.arrOwnWeapon.push(e), this.saveOwnItemRecordData(e);
    } else {
      var n = 0;

      if (o) {
        for (i = 0; i < e.length; i++) {
          for (var a = 0; a < this.arrOwnWeapon.length; a++) {
            if (this.arrOwnWeapon[a].uid == e[i].uid) {
              n++, this.arrOwnWeapon.splice(a, 1);
              break;
            }
          }
        }
      } else for (a = 0; a < this.arrOwnWeapon.length; a++) {
        if (this.arrOwnWeapon[a].uid == e.uid) {
          n++, this.arrOwnWeapon.splice(a, 1);
          break;
        }
      }

      this.saveDaySell(n);
    }

    var r = JSON.stringify(this.arrOwnWeapon);
    cc.sys.localStorage.setItem("user_ownweapon_data", r);
  }, t.upGradeWeaponData = function (t) {
    for (var e = 0; e < this.arrOwnWeapon.length; e++) {
      if (this.arrOwnWeapon[e].uid == t.uid) {
        this.arrOwnWeapon[e].level = t.level;
        break;
      }
    }

    var o = JSON.stringify(this.arrOwnWeapon);
    cc.sys.localStorage.setItem("user_ownweapon_data", o);
  }, t.saveOwnToolsData = function (t, e, o) {
    if (t) {
      if (o) for (var i = 0; i < e.length; i++) {
        this.arrOwnTools.push(e[i]), this.saveOwnItemRecordData(e[i]);
      } else this.arrOwnTools.push(e), this.saveOwnItemRecordData(e);
    } else {
      var n = 0;

      if (o) {
        for (i = 0; i < e.length; i++) {
          for (var a = 0; a < this.arrOwnTools.length; a++) {
            if (this.arrOwnTools[a].uid == e[i].uid) {
              n++, this.arrOwnTools.splice(a, 1);
              break;
            }
          }
        }
      } else for (a = 0; a < this.arrOwnTools.length; a++) {
        if (this.arrOwnTools[a].uid == e.uid) {
          n++, this.arrOwnTools.splice(a, 1);
          break;
        }
      }

      this.saveDaySell(n);
    }

    var r = JSON.stringify(this.arrOwnTools);
    cc.sys.localStorage.setItem("user_owntools_data", r);
  }, t.upGradeToolsData = function (t) {
    for (var e = 0; e < this.arrOwnTools.length; e++) {
      if (this.arrOwnTools[e].uid == t.uid) {
        this.arrOwnTools[e].level = t.level;
        break;
      }
    }

    var o = JSON.stringify(this.arrOwnTools);
    cc.sys.localStorage.setItem("user_owntools_data", o);
  }, t.saveOwnCarData = function (e) {
    for (var o = this.arrOwnBody.length, i = this.arrOwnWheel.length, n = this.arrOwnWeapon.length, r = this.arrOwnTools.length, s = 0; s < e.length; s++) {
      switch (this.saveOwnItemRecordData(e[s]), e[s].type) {
        case a.Basics_Items_Type.body:
          this.arrOwnBody.push(e[s]);
          break;

        case a.Basics_Items_Type.wheel:
          this.arrOwnWheel.push(e[s]);
          break;

        case a.Basics_Items_Type.weapon:
          this.arrOwnWeapon.push(e[s]);
          break;

        case a.Basics_Items_Type.tools:
          this.arrOwnTools.push(e[s]);
      }
    }

    o != this.arrOwnBody.length && cc.sys.localStorage.setItem("user_ownbody_data", JSON.stringify(t.arrOwnBody)), i != this.arrOwnWheel.length && cc.sys.localStorage.setItem("user_ownwheel_data", JSON.stringify(t.arrOwnWheel)), n != this.arrOwnWeapon.length && cc.sys.localStorage.setItem("user_ownweapon_data", JSON.stringify(t.arrOwnWeapon)), r != this.arrOwnTools.length && cc.sys.localStorage.setItem("user_owntools_data", JSON.stringify(t.arrOwnTools));
  }, t.initBoxData = function () {
    var e = cc.sys.localStorage.getItem("user_ownbox_data");
    if (e) for (var o = JSON.parse(e), n = 0; n < o.length; n++) {
      t.arrOwnBox.push(o[n]);
    } else for (n = 0; n < 4; n++) {
      var a = {
        index: n,
        state: i.Box_State.Empty,
        time: 0
      };
      t.arrOwnBox.push(a);
    }
  }, t.initWinning = function () {
    var t = cc.sys.localStorage.getItem("user_winning_data");
    this.nWinning = t ? Number(t) : 0;
  }, t.initTotalGame = function () {
    var t = cc.sys.localStorage.getItem("user_gametotal_data");

    if (t) {
      var e = JSON.parse(t);
      this.nTotalGame = Number(e.game), this.nTotalWin = Number(e.win);
    } else this.nTotalGame = 0, this.nTotalWin = 0;
  }, t.initOpenBoxNum = function () {
    var t = cc.sys.localStorage.getItem("user_openBoxNum_data");
    this.openBoxNum = t ? Number(t) : 0, this.loadOpenBoxNum();
  }, t.initWinTotal = function () {
    var t = cc.sys.localStorage.getItem("user_wintotal_data");
    this.nWinTotal = t ? Number(t) : 0;
  }, t.initArenaWinTotal = function () {
    var t = cc.sys.localStorage.getItem("user_arenawintotal_data");
    this.nArenaWinTotal = t ? Number(t) : 0;
  }, t.initFailTotal = function () {
    var t = cc.sys.localStorage.getItem("user_failtotal_data");
    this.nFailTotal = t ? Number(t) : 0;
  }, t.initDayWin = function () {
    var t = r.Util.getCurDayDate(),
        e = cc.sys.localStorage.getItem("user_daywin_data");

    if (e) {
      var o = JSON.parse(e);
      o && o.win ? (this.DayWinData.win = Number(o.win), this.DayWinData.date = Number(o.date), t != this.DayWinData.date && (this.DayWinData.win = 0, this.DayWinData.date = t)) : (this.DayWinData.win = 0, this.DayWinData.date = t);
    } else this.DayWinData.win = 0, this.DayWinData.date = t;
  }, t.initDaySell = function () {
    var t = r.Util.getCurDayDate(),
        e = cc.sys.localStorage.getItem("user_daysell_data");

    if (e) {
      var o = JSON.parse(e);
      o && o.sell ? (this.DaySellData.sell = Number(o.sell), this.DaySellData.date = Number(o.date), t != this.DaySellData.date && (this.DaySellData.sell = 0, this.DaySellData.date = t)) : (this.DaySellData.sell = 0, this.DaySellData.date = t);
    } else this.DaySellData.sell = 0, this.DaySellData.date = t;
  }, t.saveBoxData = function (t, e) {
    if (t) for (var o = 0; o < this.arrOwnBox.length; o++) {
      var n = this.arrOwnBox[o];

      if (n.state == i.Box_State.Empty || n.state == i.Box_State.Default || n.state == i.Box_State.Opened) {
        this.arrOwnBox[o].state = e.state, this.arrOwnBox[o].time = e.time;
        break;
      }
    } else {
      var a = e.index;
      this.arrOwnBox[a].state = e.state, this.arrOwnBox[a].time = e.time;
    }
    var r = JSON.stringify(this.arrOwnBox);
    cc.sys.localStorage.setItem("user_ownbox_data", r);
  }, t.saveTotalGame = function (t) {
    t ? (this.nTotalGame += 1, this.nTotalWin += 1, this.saveDayWin()) : this.nTotalGame += 1;
    var e = {
      game: this.nTotalGame,
      win: this.nTotalWin
    };
    cc.sys.localStorage.setItem("user_gametotal_data", JSON.stringify(e));
  }, t.saveWinTotal = function (t) {
    t ? (this.nWinTotal += 1, this.nWinTotal > i.WinTotal_Max_Time && (this.nWinTotal = i.WinTotal_Max_Time)) : this.nWinTotal = 0, cc.sys.localStorage.setItem("user_wintotal_data", this.nWinTotal);
  }, t.saveOpenBoxNum = function (t) {
    t ? this.openBoxNum += 1 : this.openBoxNum = 0, cc.sys.localStorage.setItem("user_openBoxNum_data", this.openBoxNum);
  }, t.addOpenCommonBoxNum = function () {
    this.openCommonBoxNum++, cc.sys.localStorage.setItem("openCommonBoxNum_cats", this.openCommonBoxNum);
  }, t.addOpenEpicBoxNum = function () {
    this.openEpicBoxNum++, cc.sys.localStorage.setItem("openEpicBoxNum_cats", this.openEpicBoxNum);
  }, t.addOpenLegendBoxNum = function () {
    this.openLegendBoxNum++, cc.sys.localStorage.setItem("openLegendBoxNum_cats", this.openLegendBoxNum);
  }, t.addOpenShopBoxNum = function () {
    this.openShopBoxNum++, cc.sys.localStorage.setItem("openShopBoxNum_cats", this.openShopBoxNum);
  }, t.addOpenShopCommonBoxNum = function (t) {
    void 0 === t && (t = !1), t ? this.openShopCommonBoxNum = 0 : this.openShopCommonBoxNum++, cc.sys.localStorage.setItem("openShopCommonBoxNum_cats", this.openShopCommonBoxNum);
  }, t.addOpenShopEpicBoxNum = function (t) {
    void 0 === t && (t = !1), t ? this.openShopEpicBoxNum = 0 : this.openShopEpicBoxNum++, cc.sys.localStorage.setItem("openShopEpicBoxNum_cats", this.openShopEpicBoxNum);
  }, t.addOpenShopLegendBoxNum = function (t) {
    void 0 === t && (t = !1), t ? this.openShopLegendBoxNum = 0 : this.openShopLegendBoxNum++, cc.sys.localStorage.setItem("openShopLegendBoxNum_cats", this.openShopLegendBoxNum);
  }, t.loadOpenBoxNum = function () {
    var t = Number(cc.sys.localStorage.getItem("openCommonBoxNum_cats")),
        e = Number(cc.sys.localStorage.getItem("openEpicBoxNum_cats")),
        o = Number(cc.sys.localStorage.getItem("openLegendBoxNum_cats")),
        i = cc.sys.localStorage.getItem("openShopBoxNum_cats"),
        n = Number(cc.sys.localStorage.getItem("openShopEpicBoxNum_cats")),
        a = Number(cc.sys.localStorage.getItem("openShopLegendBoxNum_cats")),
        r = Number(cc.sys.localStorage.getItem("openShopCommonBoxNum_cats"));
    t && (this.openCommonBoxNum = t), e && (this.openEpicBoxNum = e), o && (this.openLegendBoxNum = o), i && (this.openShopBoxNum = i), n && (this.openShopEpicBoxNum = n), a && (this.openShopLegendBoxNum = a), r && (this.openShopCommonBoxNum = r);
  }, t.saveArenaWinTotal = function (t) {
    t ? this.nArenaWinTotal++ : (this.nArenaWinTotal -= 3, this.nArenaWinTotal < 0 && (this.nArenaWinTotal = 0)), cc.sys.localStorage.setItem("user_arenawintotal_data", this.nArenaWinTotal);
  }, t.saveFailTotal = function (t) {
    t ? (this.nFailTotal += 1, this.nFailTotal > i.FailTotal_Max_Time && (this.nFailTotal = i.FailTotal_Max_Time)) : this.nFailTotal = 0, cc.sys.localStorage.setItem("user_failtotal_data", this.nFailTotal);
  }, t.saveWinning = function (t) {
    t ? (this.nWinning += 1, this.nWinning > i.Winning_Max_Time && (this.nWinning = i.Winning_Max_Time)) : this.nWinning = 0, cc.sys.localStorage.setItem("user_winning_data", this.nWinning);
  }, t.saveDayWin = function () {
    var t = r.Util.getCurDayDate();
    t != this.DayWinData.date && (this.DayWinData.date = t, this.DayWinData.win = 0), this.DayWinData.win += 1;
    var e = {
      win: this.DayWinData.win,
      date: this.DayWinData.date
    };
    cc.sys.localStorage.setItem("user_daywin_data", JSON.stringify(e));
  }, t.getDayWin = function () {
    var t = r.Util.getCurDayDate();
    return t != this.DayWinData.date && (this.DayWinData.date = t, this.DayWinData.win = 0), this.DayWinData.win;
  }, t.saveDaySell = function (t) {
    var e = r.Util.getCurDayDate();
    e != this.DaySellData.date && (this.DaySellData.date = e, this.DaySellData.sell = 0), this.DaySellData.sell += t;
    var o = {
      win: this.DaySellData.sell,
      date: this.DaySellData.date
    };
    cc.sys.localStorage.setItem("user_daysell_data", JSON.stringify(o));
  }, t.getDaySell = function () {
    var t = r.Util.getCurDayDate();
    return t != this.DaySellData.date && (this.DaySellData.date = t, this.DaySellData.sell = 0), this.DaySellData.sell;
  }, t.resetData = function () {
    this.nLoginTime = 0, this.nFirstDate = 0, this.nGuideStep = 0, this.nGameGrade = 0, this.nGameLevel = 0, this.nCarItemsUid = 1e3, this.isOffMusic = !1, this.nGlod = 0, this.nTrophy = 0, this.nDiamond = 30, this.vitData.time = 0, this.vitData.num = i.Vit_Init_Num, this.nTotalGame = 0, this.nTotalWin = 0, this.nWinning = 0, this.nWinTotal = 0, this.nFailTotal = 0, this.DayWinData.win = 0, this.DayWinData.date = 0, this.DaySellData.sell = 0, this.DaySellData.date = 0, this.arrOwnBox = [], this.curEquipBody = [], this.curEquipWheel = [], this.curEquipWeapon = [], this.curEquipTools = [], this.arrOwnBody = [], this.arrOwnWheel = [], this.arrOwnWeapon = [], this.arrOwnTools = [];
  }, t.majiaSwitchInfo = [], t.adList = [1095, 1084, 1045, 1046], t.recentlyUsedList = [1090, 1001, 1089], t.shareList = [1106, 1053, 1005, 1027, 1044, 1007, 1006], t.isVibrator = !0, t.bannerOnRight = !1, t.repeatClick = !1, t.Version = "1.6.1", t.isTest = !1, t.isTryCar = !1, t.gradeData = null, t.gradeRewardList = null, t.userArenaData = {
    canRefresh: !0,
    date: 0
  }, t.screenShotSF = null, t.isIllustratedBookView = !1, t.isMatchView = !1, t.isSignView = !1, t.isShopView = !1, t.initAds = !1, t.upgradeVideoList = [], t.clickUpgradeTimes = 0, t.btnShowAdEnabled = !1, t.mistakeNativeBanneProbability = 0, t.clickBoxNativeList = [], t.videoItemProbability = 0, t.btnGetDelayTime = 0, t.nativeInsertAdEnabled = !1, t.installShortCutList = [], t.isClickBoxNative = !1, t.isArenaView = !1, t.isMatchToAssembly = !1, t.hallNativeInsertAdEnabled = !1, t.nativeMatchBannerList = [], t.nativeMistakeBannerList = [], t.matchViewInsertAdList = [], t.showPanelBackHome = [], t.isRefreshMatchBanner = !1, t.timestamp_enter_game = 0, t.curRewardVideoIndex = 0, t.isGiftRushShow = !1, t.curGiftRushBannerIndex = 0, t.isInitAds = !1, t.propType = s.Props.Unknown, t.skillType = s.Props.Unknown, t.nDepotTime = {
    am: {
      star: 7,
      end: 9
    },
    pm: {
      star: 11,
      end: 14
    },
    ev: {
      star: 18,
      end: 19
    }
  }, t.isVideoLoaded = !1, t.bAuditMode = !0, t.oneMinuteInterval = !1, t.bShowAd = !1, t.bShowNativeAd = !1, t.bShowBannerAd = !1, t.bShowInsertAd = !1, t.inAdPro = 0, t.isFirstHall = !0, t.strShareType = "share", t.shareInfo = {}, t.arrShowSpeed = [], t.block_citys = [], t.block_citys_mistakeBanner = [], t.helpProp = .5, t.curCity = "", t.block_scene = [], t.block_scene_mistakeBannner = [], t.operationData = {
    sceneIds: [],
    bannerTouchSW: !1,
    probability: 0
  }, t.intersAndMatrixSwitch = 0, t.majiaGameNum = 0, t.majiaDelay = .5, t.fullScreenVideoInterval = {
    X: !1,
    Y: 60
  }, t.insertAD = {
    X: !1,
    Y: 60
  }, t.curSceneId = null, t.isShowMistakeBanner = !1, t.popup = null, t.pbf_partsArr = null, t.pbf_propsArr = null, t.pfb_starParticle = null, t.videoTab = s.VideoTab.Unknown, t.nCurGameType = n.Game_Type.PK_1, t.nEquipMax = 3, t.isOffMusic = !1, t.superCarPro = 1, t.newcomer = 1, t.nLoginTime = 0, t.nFirstDate = 0, t.nGuideStep = 0, t.nGameGrade = 0, t.nGameLevel = 0, t.nCarItemsUid = 1e3, t.nCurArenaOpponentData = null, t.nGlod = 0, t.nTrophy = 0, t.enemyTrophy = 0, t.nDiamond = 30, t.vitData = {
    time: 0,
    num: i.Vit_Init_Num
  }, t.nTotalGame = 0, t.nTotalWin = 0, t.nWinning = 0, t.nWinTotal = 0, t.nFailTotal = 0, t.DayWinData = {
    win: 0,
    date: 0
  }, t.DaySellData = {
    sell: 0,
    date: 0
  }, t.nArenaWinTotal = 0, t.arrOwnBox = [], t.openBoxNum = 0, t.openCommonBoxNum = 0, t.openEpicBoxNum = 0, t.openLegendBoxNum = 0, t.openShopBoxNum = 0, t.openShopCommonBoxNum = 0, t.openShopEpicBoxNum = 0, t.openShopLegendBoxNum = 0, t.aIDifficultyLevelData = {
    win: 0,
    fail: 0,
    level: 0
  }, t.signPopup = !0, t.freePopup = !0, t.coinPopup = !0, t.spareCoin = 0, t.gameMode = s.GameMode.Match, t.arenaModeDataList = [], t.upgradeState = 0, t.curEquipBody = [], t.curEquipWheel = [[], [], []], t.curEquipWeapon = [[], [], []], t.curEquipTools = [[], [], []], t.superChariotData = {
    arrBody: [],
    arrWheel: [],
    arrWeapon: [],
    arrTools: [],
    power: "0"
  }, t.freeCarData = {
    arrBody: [],
    arrWheel: [],
    arrWeapon: [],
    arrTools: [],
    power: "0"
  }, t.tempExchangeData = {
    curEquipBody: [],
    curEquipWheel: [],
    curEquipWeapon: [],
    curEquipTools: []
  }, t.swapCarIndex = -1, t.superCarPanel = null, t.hallCarView = null, t.arrOwnBody = [], t.arrOwnWheel = [], t.arrOwnWeapon = [], t.arrOwnTools = [], t.arrItemRecord = [], t.exptInfo = s.ExptInfo.unknown, t;
}();

o["default"] = d, d.resetData();

cc._RF.pop();